package per.mapt.mybatis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public String obUser(Integer id) {
        User user = userMapper.selectUser(id);
        System.out.println(user.getName());
        return user.getCode();
    }

    public String obUser2(Integer id) {
        return userMapper.selectUserName(id);
    }
}
